package org.deadline.service.config;

import java.util.List;
import org.deadline.model.config.UIControlConfiguration;
import org.deadline.repository.config.UIControlConfigurationRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


@Service
@Transactional
public class UIControlConfigurationServiceImpl implements UIControlConfigurationService {

	@Autowired
    UIControlConfigurationRepository uIControlConfigurationRepository;

	public long countAllUIControlConfigurations() {
        return uIControlConfigurationRepository.count();
    }

	public void deleteUIControlConfiguration(UIControlConfiguration UIControlConfiguration_) {
        uIControlConfigurationRepository.delete(UIControlConfiguration_);
    }

	public UIControlConfiguration findUIControlConfiguration(Long id) {
        return uIControlConfigurationRepository.findOne(id);
    }

	public List<UIControlConfiguration> findAllUIControlConfigurations() {
        return uIControlConfigurationRepository.findAll();
    }

	public List<UIControlConfiguration> findUIControlConfigurationEntries(int firstResult, int maxResults) {
        return uIControlConfigurationRepository.findAll(new org.springframework.data.domain.PageRequest(firstResult / maxResults, maxResults)).getContent();
    }

	public void saveUIControlConfiguration(UIControlConfiguration UIControlConfiguration_) {
        uIControlConfigurationRepository.save(UIControlConfiguration_);
    }

	public UIControlConfiguration updateUIControlConfiguration(UIControlConfiguration UIControlConfiguration_) {
        return uIControlConfigurationRepository.save(UIControlConfiguration_);
    }
}
